package com.changgou.goods.feign;

import com.changgou.entity.Result;
import com.changgou.goods.pojo.Sku;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

//声明feign的客户端,远程调用goods微服务
@FeignClient(name = "goods")
public interface SkuFeign {
    //根据spuId查询sku的列表信息
    @GetMapping("/sku/spu/{spuId}")
    public List<Sku> findSkuListBySpuId(@PathVariable("spuId")String SpuId);


    @GetMapping("/sku/{id}")
    public Result<Sku> findById(@PathVariable String id);

    //删除库存
    @PostMapping("/sku/decr/count")
    public Result decrCount(@RequestParam("username") String username);
}
